<?php
/*
 * @Author: your name
 * @Date: 2019-12-23 16:29:39
 * @LastEditTime : 2020-01-03 13:44:08
 * @LastEditors  : Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /ahsmp_3/application/adminapiv3/controller/IpsOriginalRule.php
 */
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2019/11/20
 * Time: 13:56
 */

namespace app\adminapiv3\controller;

//ips 原始规则

class IpsOriginalRule extends BaseController
{
    /**
     * @name 列表
     * @author wx
     * @date 2019/11/20 16:38
     */
    public function list($host_id)
    {
        $params['rule'] = $this->filterInput('rule','get');

        $server = new \app\adminapiv3\service\IpsOriginalRule();
        $list = $server->toDo('list',[$host_id, $params]);

        $this->jsonOutPut($list);
    }

    /**
     * @name 打开监控
     * @author wx
     * @date 2019/11/20 16:38
     */
    public function openMonitor($host_id)
    {
        $server = new \app\adminapiv3\service\IpsOriginalRule();
        $id = $this->filterInput('id*');


        $params['status'] = 1;
        $params['host_id'] = $host_id;
        $data = $server->toDo('modify',[$id, $params]);

        $this->jsonOutPut([],true);
        $this->Async('Hgshield', 'onOriginalRule', [$data]);
    }

    /**
     * @name 关闭监控
     * @author wx
     * @date 2019/11/20 16:38
     */
    public function closeMonitor($host_id)
    {
        $server = new \app\adminapiv3\service\IpsOriginalRule();
        $id = $this->filterInput('id*');


        $params['status'] = 0;
        $params['host_id'] = $host_id;
        $data = $server->toDo('modify',[$id, $params]);

        $this->jsonOutPut([],true);
        $this->Async('Hgshield', 'offOriginalRule', [$data]);
    }

    /**
     * @name 删除
     * @author wx
     * @date 2019/11/20 16:38
     */
    public function del($host_id)
    {
        $server = new \app\adminapiv3\service\IpsOriginalRule();
        $id = $this->filterInput('id*');

        $data = $server->toDo('del', [$id, $host_id]);

        $this->jsonOutPut([],true);
        $this->Async('Hgshield', 'delOriginalRule', [$data]);
    }

    /**
     * @name: 转换规则并上传
     * @Param: 
     * @Description: 
     * @Author: wx
     * @Date: 2019-11-29 14:27:03
     */
    public function importRule($host_id)
    {
        $server = new \app\adminapiv3\service\IpsOriginalRule();

        $list = $server->toDo('importRule', [$host_id]);

        $this->jsonOutPut($list, true);
        $this->Async('Hgshield', 'convertRule');
    }
}